// eslint-disable-next-line @typescript-eslint/no-var-requires
const { VantResolver } = require('unplugin-vue-components/resolvers');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const ComponentsPlugin = require('unplugin-vue-components/webpack');

module.exports = {
  configureWebpack: {
    plugins: [
      ComponentsPlugin({
        resolvers: [VantResolver()],
      }),
    ],
  },
  devServer: {
    //以上的ip和端口是我们本机的;下面为需要跨域的
    proxy: { //配置跨域
      '/api': {
        target: 'http://bookkeeping.omisheep.cn/api', //这里后台的地址模拟的;应该填写你们真实的后台接口
        ws: true,
        changOrigin: true, //允许跨域
        // logLevel: 'debug',
        pathRewrite: {
          '^/api': '' //请求的时候使用这个api就可以
        }
      }
    }
  },
  // publicPath: './',
  outputDir: process.env.outputDir,
  publicPath: process.env.NODE_ENV === "production" ? "./" : "./"
  // process.env.outputDir：'dist', // 输出文件目录 outputDir: ,
};